/**
 * 
 */
package observer;

import java.util.Observable;
import java.util.Observer;

/**
 * @author Kevin Wagner
 * @version 1.0
 * 
 */
public class ConsoleObserver implements Observer {

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
	 */
	@Override
	public void update(Observable o, Object arg) {
		if (arg instanceof Exception) {
			Exception e = ((Exception) arg);
			System.err.println(e.getMessage());
			for (int i = 0; i < e.getStackTrace().length; i++) {
				System.err.println(e.getStackTrace()[i].toString());
			}
		} else if (arg instanceof String) {
			System.out.println(arg);
		} else {
			System.out.println(arg.toString());
		}

	}

}
